import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import SwiperDemo from "../views/SwiperDemo.vue";

Vue.use(VueRouter)

const routes = [
    {
        path: '/SwiperDemo',
        name: 'SwiperDemo',
        component: SwiperDemo,
    },
    {
        path: '/',
        name: 'HeadHome',
        component: () => import(/* webpackChunkName: "about" */ '../views/HeadHomeView.vue'),
        children: [{

            path: '/',
            name: 'home',
            component: HomeView,
            redirect: "/about",
            children: [
                {
                    path: '/about',
                    name: 'about',
                    // route level code-splitting
                    // this generates a separate chunk (about.[hash].js) for this route
                    // which is lazy-loaded when the route is visited.
                    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
                },
                {
                    path: '/ranking',
                    name: 'ranking',
                    component: () => import('../views/Ranking.vue')
                },
                {
                    path: '/deil',
                    name: 'deil',
                    component: () => import('../views/deil.vue')
                }, {
                    path: '/highsearch',
                    name: 'highsearch',
                    component: () => import('../views/HighSearch.vue')
                },
                {
                    path: '/search',
                    name: 'search',
                    component: () => import('../views/search.vue'),
                    /*children: [
                        {
                            //勿删,备份
                            path: '/searchListById',
                            name: 'searchListById',
                            component: () => import('../views/search/sortById.vue')
                        }
                    ]*/
                },
                {
                    path: '/navigation',
                    name: 'navigation',
                    component: () => import('../views/NavigationView.vue'),
                    children: [
                        {
                            /*我的小驿*/
                            path: '/information/myHomePage',
                            name: 'myHomePage',
                            component: () => import('../views/information/MyHomePage.vue')
                        },
                        {
                            /*订单*/
                            path: '/information/orders',
                            name: 'orders',
                            component: () => import('../views/information/Orders.vue')
                        },
                        {
                            /*收藏路由*/
                            path: '/information/collection',
                            name: 'collection',
                            component: () => import('../views/information/Collection.vue')
                        },
                        {
                            /*评论路由*/
                            path: '/information/comment',
                            name: 'collection',
                            component: () => import('../views/information/Comment.vue')
                        },
                        {
                            /*个人信息路由*/
                            path: '/information/userinfo',
                            name: 'userinfo',
                            component: () => import('../views/information/UserInfoView.vue')
                        },
                        {
                            /*个修改密码路由*/
                            path: '/information/changePassword',
                            name: 'changePassword',
                            component: () => import('../views/information/ChangePassword.vue')
                        },
                        {
                            /*收获地址路由*/
                            path: '/information/address',
                            name: 'address',
                            component: () => import('../views/information/Address.vue'),
                        },
                        {
                            /*收货地址添加*/
                            path: '/information/AddressAdd',
                            name: 'AddressAdd',
                            component: () => import('../views/information/AddressAdd.vue')
                        },
                        {
                            /*收货地址修改*/
                            path: '/information/AddressUpdate',
                            name: 'AddressUpdate',
                            component: () => import('../views/information/AddressUpdate.vue')
                        }
                    ]
                },
            ]
        },
            {
                /*购物车路由,勿删*/
                path: '/shoppingCar',
                name: 'shoppingCar',
                component: () => import('../views/shoppingCar.vue')
            },
            {
                /*订单路由,勿删*/
                path: '/Order',
                name: 'Order',
                component: () => import('../views/Order.vue')
            },
            {
                /*订单结束*/
                path: '/finishOrder',
                name: 'finishOrder',
                component: () => import('../views/finishOrder.vue')
            },
        ]
    },
    {
        path: '/userlogin',
        name: 'navigation',
        component: () => import('../views/UserLoginView.vue')
    }, {
        path: '/userreg',
        name: 'userreg',
        component: () => import('../views/UserRegView.vue')
    },
    // {
    //   /*购物车路由,勿删*/
    //   path: '/shoppingCar',
    //   name: 'shoppingCar',
    //   component: () => import('../views/shoppingCar.vue')
    // },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
